import { useSearchParams, useNavigate } from "react-router-dom"

function Article() {
  const navigate = useNavigate()
  // useSearchParams钩子函数用于接收类似vue的query传参，如 navigate('/article?id=1&name=yx')
  const [params] = useSearchParams()
  const id = params.get('id')
  const name = params.get('name')
  return (
    <div>
      <div>我是文章页</div>
      {/* 类型vue中的params传参，需要在路由列表里面配置参数 */}
      <button onClick={()=>navigate('/login/888/yx')}>跳转到登录页</button>
      <div>{id}-{name}</div>
    </div>
  )
}
export default Article